package com.Wy.Demo10;

import java.util.ArrayList;

public class StudentText {
    public static void main(String[] args) {
        ArrayList<Student> List = new ArrayList<>();
        List.add(new Student("张三",1));
        List.add(new Student("李四",2));
        List.add(new Student("王五",3));

        for (int i = 0; i < List.size(); i++) {
            Student x = List.get(i);
            if (x.getName().equals("张三")){
                x.setName("张桐");
            }
            if (x.getName().equals("王五")){
                List.remove(x);
            }
        }
        for (int i = 0; i < List.size(); i++) {
            System.out.println(List.get(i));
        }
    }


    }

